<template>
	<view class="swap" :commondata="commondata" :change:commondata="ether.getalldata" :token1num="token1num"
		:change:token1num="ether.gettoken2num" :approvestatus="approvestatus" :change:approvestatus="ether.approve"
		:implementid="implementid" :change:implementid="ether.implement">
		<view class="block1">
			<view class="line1">
				<view class="left">
					从
				</view>
				<view class="right">
					<view class="text">
						余额：{{ Number(Number(token1usernum).toFixed(4)) }}
					</view>
				</view>
			</view>
			<view class="line2" :token1="token1" :change:token1="ether.token1change">
				<view class="left" @tap="openselecttoken(1)">
					<image v-if="token1.name=='请选择'" class="tokenicon" src="/static/images/notoken.png" mode="widthFix">
					</image>
					<image v-if="token1.name!='请选择'" class="tokenicon"
						:src="'../../static/images/tokenicon/'+token1.contract+commondata.addressInfo.chainType+commondata.addressInfo.chainId+'.png'"
						mode="widthFix"></image>
					<view class="texts">
						<view class="text1">
							{{token1.name}}
						</view>
						<view class="text2">
							JumpFinace
						</view>
					</view>
					<image class="xiala" src="@/static/images/newimg31.png" mode="widthFix"></image>
				</view>
				<view class="right">
					<uni-easyinput type='number' :disabled="token1.name=='请选择'||token2.name=='请选择'" class="input"
						v-model="token1num" placeholder="请输入代币数量" />
				</view>
			</view>
			<view class="line4" style="margin-top:20upx;">
				<view class="left">
					到
				</view>
				<view class="right">
					<view class="text">
						余额：{{ Number(Number(token2usernum).toFixed(4)) }}
					</view>
				</view>
			</view>
			<view class="line5" :token2="token2" :change:token2="ether.token2change">
				<view class="left" @tap="openselecttoken(2)">
					<image v-if="token2.ico==''" class="tokenicon" src="/static/images/notoken.png" mode="widthFix">
					</image>
					<image v-if="token2.ico!=''" class="tokenicon"
						:src="'../../static/images/tokenicon/'+token2.contract+commondata.addressInfo.chainType+commondata.addressInfo.chainId+'.png'"
						mode="widthFix"></image>
					<view class="texts">
						<view class="text1">
							{{token2.name}}
						</view>
						<view class="text2">
							JumpFinace
						</view>
					</view>
					<image class="xiala" src="@/static/images/newimg31.png" mode="widthFix"></image>
				</view>
				<view class="right">
					{{ Number(Number(token2num).toFixed(4)) }}
				</view>
			</view>
			<view class="line6">
				<view class="button button1" @tap="ether.duihuan">
					兑换
				</view>
				<view class="button button2" @tap="toswapaddliquidity">
					添加流动性
				</view>
			</view>
		</view>
		<view class="block2">
			<view class="line">
				<view class="left">兑换路径</view>
				<view class="right" v-show="token1.name=='请选择'||token2.name=='请选择'">请选择
				</view>
				<view class="right" v-show="token1.name!='请选择'&&token2.name!='请选择'">
					{{token1.name}} to {{token2.name}}
				</view>
			</view>
			<view class="line">
				<view class="left">参考价格</view>
				<view class="right" v-show="token1.name=='请选择'||token2.name=='请选择'">请选择
				</view>
				<view class="right" v-show="token1.name!='请选择'&&token2.name!='请选择'">
					1{{token1.name}}≈{{ Number(Number(price).toFixed(4)) }}{{token2.name}}
				</view>
			</view>
		</view>
		<view class="logBox" v-if="log.length>0">
			<view class="title">
				<text>最近一条记录</text>
				<text class="more" @tap="swaplogPage">更多记录</text>
			</view>
			<log :data="log[0]"></log>
		</view>
	</view>
</template>
<script>
	import common from '@/js_sdk/common/common.js'
	export default {
		props: {
			log: {
				type: Array,
				default: []
			},
		},
		data() {
			return {
				token1: {
					"name": "请选择",
					"symbol": "请选择",
					"contract": "",
					"decimal": "18",
					"ico": ""
				},
				token2: {
					"name": "请选择",
					"symbol": "请选择",
					"contract": "",
					"decimal": "18",
					"ico": ""
				},
				// token1num输入数量
				token1num: "",
				// token1num用户数量
				token1usernum: "0",
				// token2num输入数量
				token2num: "0",
				// tokne2用户拥有数量
				token2usernum: "0",
				// 判断选择代币的时候选的是token1还是token2
				type: "",
				// 价格
				price: "0",
				// 是否执行授权
				approvestatus: false,
				// 要执行的ID
				implementid: ""
			}
		},
		computed: {
			commondata() {
				if (this.$store.getters.addressInfo.chainId != "5867") {
					this.token1 = {
						"name": "请选择",
						"symbol": "请选择",
						"contract": "",
						"decimal": "18",
						"ico": ""
					};
					this.token2 = {
						"name": "请选择",
						"symbol": "请选择",
						"contract": "",
						"decimal": "18",
						"ico": ""
					}
					this.token1usernum = 0;
					this.token2usernum = 0;
					this.token1num = "";

				}
				return {
					addressInfo: this.$store.getters.addressInfo,
					selectedRpc: this.$store.getters.getRpc,
					config: common.config,
				}
			},
		},
		methods: {
			...common.methonds,
			// 打开选择代币弹窗
			openselecttoken(type) {
				if (this.commondata.addressInfo.chainType != "ETH" || this.commondata.addressInfo.chainId != "5867") {
					this.error("请切换到JumpFinance链进行操作")
					return
				}
				this.type = type
				this.$emit("openselecttoken");
			},
			// 父级选择好token后执行
			selecttoken(item) {
				if (this.type == '1') {
					if (item.contract == this.token2.contract) {
						this.token2 = this.token1
					}
					this.token1 = item
				} else {
					if (item.contract == this.token1.contract) {
						this.token1 = this.token2
					}
					this.token2 = item
				}
				this.token1num = ""
			},
			// 获取代币1的数量
			returntoken1usernum(num) {
				this.token1usernum = num
				uni.hideLoading()
			},
			// 获取代币2的数量
			returntoken2usernum(num) {
				this.token2usernum = num
				uni.hideLoading()
			},
			// 打开授权弹窗
			approveopen() {
				let data = {
					type: "SWAP",
					token: this._token1,
					tip: "使用兑换功能需要对代币进行授权，授权成功后请重新操作。"
				}
				this.$emit("approveopen", data);
			},
			// 获取参考价格
			getprice2(data) {
				this.price = data
			},
			// 计算token2的数量
			gettoken2num2(data) {
				this.token2num = data
			},
			// 跳转到添加流动性页面
			toswapaddliquidity() {
				if (this.commondata.addressInfo.chainType != "ETH" || this.commondata.addressInfo.chainId != "5867") {
					this.error("请切换到JumpFinance链进行操作")
					return
				}
				uni.navigateTo({
					url: "/pages/swapaddliquidity/index"
				})
			},
			// 打开确认弹窗
			openimplement(data) {
				let info = {
					type: "SWAP",
					data: {
						...data
					},
				}
				this.$emit("executionopen", info)
			},
			// 修改预授权状态
			changeapprovestatus(status) {
				this.approvestatus = status
			},
			// 执行结束
			implementover() {
				this.token1num = ""
				this.token2num = 0
			},
			swaplogPage() {
				uni.navigateTo({
					url: `/pages/swaplogPage/swaplogPage`
				})
			},
			//交易完请求添加记录接口
			addSwapLog(hash) {
				this.$emit("addSwapLog", hash)
			},
		}
	}
</script>
<script module="ether" lang="renderjs">
	export default {
		data() {
			return {
				commondata: {},
				token1: {
					name: "请选择",
					contract: "",
					tokenicon: '',
					decimal: '18'
				},
				token2: {
					name: "请选择",
					contract: "",
					tokenicon: '',
					decimal: '18'
				},
				token1usernum: 0,
				token1num: 0,
				token2usernum: 0,
				token2num: 0,
				implementidinfo: null,
				implementid: null
			}
		},
		mounted() {
			// 动态引入较大类库避免影响页面展示
			let script = document.createElement('script')
			script.src = 'static/script/ethers-5.2.umd.min.js'
			document.head.appendChild(script)
		},
		methods: {
			// 同步数据
			getalldata(newValue) {
				if (newValue) {
					this.commondata = newValue
				}
			},
			// token1选择代币
			async token1change(newValue) {
				if (newValue.name != "请选择") {
					this.$ownerInstance.callMethod('showloading')
					try {
						this.token1 = newValue
						let provider = new ethers.providers.JsonRpcProvider(this.commondata.selectedRpc);
						let signer = new ethers.Wallet(this.commondata.addressInfo.privateKey, provider);
						let address = signer.address
						if (newValue.contract == this.commondata.config.weth) {
							let data = await provider.getBalance(address)
							this.token1usernum = ethers.utils.formatUnits(data, "18")
						} else {
							let contract = new ethers.Contract(newValue.contract, this.commondata
								.config.erc20abi, signer);
							let data = await contract.balanceOf(address)
							this.token1usernum = ethers.utils.formatUnits(data, newValue.decimal)
						}
						this.$ownerInstance.callMethod('returntoken1usernum', this.token1usernum)
					} catch (e) {
						this.$ownerInstance.callMethod('error', "合约执行失败")
					}
					this.$ownerInstance.callMethod('hideloading')
					this.getprice()

				}
			},
			// token2选择代币
			async token2change(newValue) {
				if (newValue.name != "请选择") {
					this.$ownerInstance.callMethod('showloading')
					try {
						this.token2 = newValue
						let provider = new ethers.providers.JsonRpcProvider(this.commondata.selectedRpc);
						let signer = new ethers.Wallet(this.commondata.addressInfo.privateKey, provider);
						let address = signer.address
						if (newValue.contract == this.commondata.config.weth) {
							let data = await provider.getBalance(address)
							this.token2usernum = ethers.utils.formatUnits(data, "18")

						} else {
							let contract = new ethers.Contract(newValue.contract, this.commondata
								.config.erc20abi, signer);
							let data = await contract.balanceOf(address)

							this.token2usernum = ethers.utils.formatUnits(data, newValue.decimal)
						}
						this.$ownerInstance.callMethod('returntoken2usernum', this.token2usernum)

					} catch (e) {
						this.$ownerInstance.callMethod('error', "合约执行失败")
					}
					this.$ownerInstance.callMethod('hideloading')

					this.getprice()
				}
			},
			// 获取单价
			async getprice() {
				if (this.token1 && this.token1.name != "请选择" && this.token2 && this.token2.name != "请选择") {
					this.$ownerInstance.callMethod('showloading')
					try {
						let provider = new ethers.providers.JsonRpcProvider(this.commondata.selectedRpc);
						let signer = new ethers.Wallet(this.commondata.addressInfo.privateKey, provider);
						let address = signer.address
						let contract = new ethers.Contract(this.commondata.config.swaprouter, this.commondata
							.config
							.routerabi, signer);
						let data;
						if (this.token1.contract == this.commondata.config.weth || this.token2.contract ==
							this
							.commondata.config.weth) {
							data = await contract.getAmountsOut(ethers.utils.parseUnits('1', this.token1.decimal), [
								this.token1.contract,
								this.token2.contract
							])
						} else {
							data = await contract.getAmountsOut(ethers.utils.parseUnits('1', this.token1
								.decimal), [this.token1.contract,
								this.commondata.config.weth,
								this.token2.contract
							])
						}
						this.$ownerInstance.callMethod('getprice2', ethers.utils.formatUnits(data[1].toString(), this
							.token2.decimal))

					} catch (e) {
						this.$ownerInstance.callMethod('error', "合约执行失败")
					}
					this.$ownerInstance.callMethod('hideloading')
				}
			},
			// token1数量发生变化,计算token2数量
			async gettoken2num(newValue) {
				if (newValue == "" && this.$ownerInstance) {
					this.token1num = ""
					this.$ownerInstance.callMethod('gettoken2num2', 0)
					return
				}
				if (newValue) {
					this.token1num = newValue
					if (this.token1.name == '请选择' || this.token2.name == '请选择') {
						this.token2num = 0
						this.$ownerInstance.callMethod('gettoken2num2', this.token2num)
						return
					}
					if (newValue <= 0) {
						this.token2num = 0
						this.$ownerInstance.callMethod('gettoken2num2', this.token2num)
						return
					}
					this.$ownerInstance.callMethod('showloading')
					try {
						let provider = new ethers.providers.JsonRpcProvider(this.commondata.selectedRpc);
						let signer = new ethers.Wallet(this.commondata.addressInfo.privateKey, provider);
						let address = signer.address
						let contract = new ethers.Contract(this.commondata.config.swaprouter, this.commondata
							.config.routerabi, signer);
						if (this.token1.contract == this.commondata.config.weth || this.token2
							.contract == this.commondata.config.weth) {
							let data = await contract.getAmountsOut(ethers.utils.parseUnits(newValue,
								this.token1.decimal), [this.token1.contract,
								this.token2.contract
							])
							this.token2num = ethers.utils.formatUnits(data[1].toString(), this.token2.decimal)
						} else {
							let data = await contract.getAmountsOut(ethers.utils.parseUnits(newValue,
								this
								.token1
								.decimal), [this.token1.contract,
								this.commondata.config.weth,
								this.token2.contract
							])
							this.token2num = ethers.utils.formatUnits(data[1].toString(), this.token2.decimal)
						}
						this.$ownerInstance.callMethod('gettoken2num2', this.token2num)
					} catch (e) {
						this.$ownerInstance.callMethod('error', "合约执行失败")
					}
					this.$ownerInstance.callMethod('hideloading')

				}
			},
			// 预执行兑换
			async duihuan() {
				if (this.commondata.addressInfo.chainType != "ETH" || this.commondata.addressInfo.chainId != "5867") {
					this.$ownerInstance.callMethod("error", '请切换到JumpFinance链进行操作')
					return
				}
				if (this.token1.name == "请选择" || this.token2.name == "请选择") {
					return this.$ownerInstance.callMethod("error", '请选择代币')
				}
				if (this.token1num == "") {
					return this.$ownerInstance.callMethod("error", '请输入代币数量')
				}
				if (Number(this.token1num) <= 0) {
					return this.$ownerInstance.callMethod("error", '请输入正确代币数量')
				}
				if (Number(this.token1num) > Number(this.token1usernum)) {
					return this.$ownerInstance.callMethod("error", "代币" + this.token1.name + '数量不足')
				}
				this.$ownerInstance.callMethod('showloading')
				try {
					let provider = new ethers.providers.JsonRpcProvider(this.commondata.selectedRpc);
					let signer = new ethers.Wallet(this.commondata.addressInfo.privateKey, provider);
					let address = signer.address
					let GasPrice = await provider.getGasPrice()
					let timestamp = Date.now() + 60000;
					if (this.token1.contract != this.commondata.config.weth) {

						let contract = new ethers.Contract(this.token1.contract, this.commondata.config
							.erc20abi,
							signer);
						let data = await contract.allowance(address, this.commondata.config.swaprouter)
						let allowancenum = data.toString()
						if (Number(allowancenum) < Number(ethers.utils.parseUnits(this.token1num.toString(), this
								.token1
								.decimal))) {
							this.$ownerInstance.callMethod('hideloading')
							this.$ownerInstance.callMethod('approveopen')
							return
						}
					}
					let contract = new ethers.Contract(this.commondata.config.swaprouter, this.commondata.config
						.routerabi, signer);
					let data, res = null;
					let test1;
					if (this.token1.contract == this.commondata.config.weth) {
						test1 = "swapExactETHForTokens"
						let Gaslimit = await contract.estimateGas.swapExactETHForTokens(1, [
								this.token1.contract,
								this.token2.contract
							],
							address, timestamp, {
								value: ethers.utils.parseUnits(this.token1num, this.token1
									.decimal)
							}
						)
						data = await contract.populateTransaction.swapExactETHForTokens(1, [
								this.token1.contract,
								this.token2.contract
							],
							address, timestamp, {
								value: ethers.utils.parseUnits(this.token1num, this.token1
									.decimal),
								gasPrice: GasPrice.toString(),
								gasLimit: Gaslimit.toString()
							}
						)

					} else if (this.token2.contract == this.commondata.config.weth) {
						test1 = "swapExactTokensForETH"
						let Gaslimit = await contract.estimateGas.swapExactTokensForETH(ethers.utils.parseUnits(this
								.token1num, this.token1.decimal), 1, [
								this.token1.contract,
								this.token2.contract
							],
							address, timestamp
						)
						data = await contract.populateTransaction.swapExactTokensForETH(ethers.utils.parseUnits(this
								.token1num, this.token1.decimal), 1, [
								this.token1.contract,
								this.token2.contract
							],
							address, timestamp, {
								value: ethers.BigNumber.from("0"),
								gasPrice: GasPrice.toString(),
								gasLimit: Gaslimit.toString()
							}
						)
					} else {
						test1 = "swapExactTokensForTokens"
						let Gaslimit = await contract.estimateGas.swapExactTokensForTokens(ethers.utils
							.parseUnits(String(this.token1num), this.token1.decimal),
							1, [
								this.token1.contract, this.commondata.config.weth, this.token2.contract
							],
							address, timestamp
						)
						data = await contract.populateTransaction.swapExactTokensForTokens(ethers.utils
							.parseUnits(String(this.token1num), this.token1.decimal),
							1, [
								this.token1.contract, this.commondata.config.weth, this.token2.contract
							],
							address, timestamp, {
								value: ethers.BigNumber.from("0"),
								gasPrice: GasPrice.toString(),
								gasLimit: Gaslimit.toString()
							}
						)
					}
					this.implementidinfo = data
					this.implementid = Date.now()
					res = {
						from: data.from,
						to: data.to,
						value: ethers.utils.formatUnits(data.value, "ether"),
						data: data.data,
						gasLimit: data.gasLimit.toString(),
						gasPrice: ethers.utils.formatUnits(data.gasPrice, "gwei"),
						fee: ethers.utils.formatUnits(data.gasLimit * data.gasPrice, "ether"),
						id: this.implementid,
						num: this.token1num,
						symbol: this.token1.name,
						methond: test1,
						valueEther: ethers.utils.parseUnits(this.token1num, this.token1.decimal).toString(),
						from_contract: this.token1.contract,
						to_contract: this.token2.contract,
						to_amount: ethers.utils.parseUnits(this.token2num, this.token2.decimal).toString()
					}
					this.$ownerInstance.callMethod('openimplement', res)

				} catch (e) {
					this.$ownerInstance.callMethod('error', "合约执行失败")
				}
				this.$ownerInstance.callMethod('hideloading')

			},
			// 预授权
			async approve(newValue) {

				if (newValue) {
					this.$ownerInstance.callMethod('showloading')
					try {
						this.$ownerInstance.callMethod('changeapprovestatus', false)
						let provider = new ethers.providers.JsonRpcProvider(this.commondata.selectedRpc);
						let signer = new ethers.Wallet(this.commondata.addressInfo.privateKey, provider);
						let address = signer.address
						let GasPrice = await provider.getGasPrice()
						let contract = new ethers.Contract(this.token1.contract, this.commondata.config
							.erc20abi,
							signer);




						let Gaslimit = await contract.estimateGas.approve(this.commondata.config.swaprouter, this
							.commondata
							.config
							.approvenum)
						let data = await contract.populateTransaction.approve(this.commondata.config.swaprouter,
							this.commondata
							.config
							.approvenum, {
								value: ethers.BigNumber.from("0"),
								gasPrice: GasPrice.toString(),
								gasLimit: Gaslimit.toString()
							})

						this.implementidinfo = data
						this.implementid = Date.now()
						let res = {
							from: data.from,
							to: data.to,
							value: ethers.utils.formatUnits(data.value, "ether"),
							data: data.data,
							gasLimit: data.gasLimit.toString(),
							gasPrice: ethers.utils.formatUnits(data.gasPrice, "gwei"),
							fee: ethers.utils.formatUnits(data.gasLimit * data.gasPrice, "ether"),
							id: this.implementid,
							num: this.token1.name,
							methond: "approve"
						}
						this.$ownerInstance.callMethod('openimplement', res)
					} catch (e) {
						this.$ownerInstance.callMethod('error', "合约执行失败")
					}
					this.$ownerInstance.callMethod('hideloading')
				}

			},
			// 去执行
			async implement(newValue) {
				if (newValue == this.implementid) {
					this.$ownerInstance.callMethod('showloading')
					try {
						let provider = new ethers.providers.JsonRpcProvider(this.commondata.selectedRpc);
						let signer = new ethers.Wallet(this.commondata.addressInfo.privateKey, provider);
						let res = await signer.sendTransaction(this.implementidinfo)
						let calldata = await provider.waitForTransaction(res.hash);
						if (calldata.status == 1) {
							this.$ownerInstance.callMethod("error", '交易请求成功')
							this.$ownerInstance.callMethod("addSwapLog", res.hash)
						}
						this.token1change(this.token1)
						this.token2change(this.token2)
						this.token1num = ""
						this.token2num = 0
						this.$ownerInstance.callMethod('implementover')
					} catch (e) {
						this.$ownerInstance.callMethod('error', "合约执行失败")
					}
					this.$ownerInstance.callMethod('hideloading')
				}
			},
		}
	}
</script>

<style lang="less" scoped>
	.swap {
		padding-top: 26upx;
		height: 100%;
		overflow-y: scroll;
		padding-bottom: 100upx;
		box-sizing: border-box;

		.block1 {
			width: 702upx;
			background-color: #fff;
			border-radius: 32upx;
			padding: 40upx 24upx;
			box-sizing: border-box;
			margin: 0upx auto;

			.line1 {
				display: flex;
				justify-content: space-between;
				align-items: center;

				.left {
					font-size: 28upx;
					color: #666666;
				}

				.right {
					display: flex;
					align-items: center;

					.image {
						width: 48upx;
					}

					.text {
						font-size: 28upx;
						color: #666666;
					}
				}
			}

			.line2 {
				width: 654upx;
				height: 140upx;
				background-color: #F7F7F7;
				border-radius: 24upx;
				box-sizing: border-box;
				padding: 26upx 24upx;
				margin-top: 16upx;
				display: flex;
				align-items: center;

				.left {
					display: flex;
					align-items: center;
					width: 70%;

					.tokenicon {
						width: 72upx;
					}

					.texts {
						.text1 {
							font-size: 28upx;
							color: #333333;
						}

						.text2 {
							font-size: 18upx;
							color: #999999;
							margin-top: 4upx;
						}

						margin-left:24upx;
					}

					.xiala {
						width: 24upx;
						margin-left: 20upx;
					}
				}

				.right {
					margin-left: 50upx;

					input {
						height: 100upx;
						line-height: 100upx;
						font-size: 32upx;
						// text-align: right;
					}
				}
			}

			.line3 {

				.image {
					display: block;
					margin: 0px auto;
					width: 64upx;
					margin-top: 24upx;
				}
			}

			.line4 {
				display: flex;
				justify-content: space-between;
				align-items: center;

				.left {
					font-size: 28upx;
					color: #666666;
				}

				.right {
					display: flex;
					align-items: center;

					.image {
						width: 48upx;
					}

					.text {
						font-size: 28upx;
						color: #666666;
					}
				}
			}

			.line5 {
				width: 654upx;
				height: 140upx;
				background-color: #F7F7F7;
				border-radius: 24upx;
				box-sizing: border-box;
				padding: 26upx 24upx;
				margin-top: 16upx;
				display: flex;
				align-items: center;
				justify-content: space-between;

				.left {
					display: flex;
					align-items: center;
					width: 50%;

					.tokenicon {
						width: 72upx;
					}

					.texts {
						.text1 {
							font-size: 28upx;
							color: #333333;
						}

						.text2 {
							font-size: 18upx;
							color: #999999;
							margin-top: 4upx;
						}

						margin-left:24upx;
					}

					.xiala {
						width: 24upx;
						margin-left: 20upx;
					}
				}

				.right {
					font-size: 28upx;
					color: #333333;
				}
			}

			.line6 {
				width: 100%;
				box-sizing: border-box;
				display: flex;
				justify-content: space-between;
				margin-top: 40upx;

				.button {
					width: 303upx;
					line-height: 92upx;
					text-align: center;

					color: #fff;
					border-radius: 16upx;
				}

				.button1 {
					background-color: #FFBC42;
				}

				.button2 {
					background-color: #03BAE8;
				}
			}

			.line8 {
				margin-top: 30upx;

				.input {
					height: 100upx;
				}
			}
		}

		.block2 {
			width: 702upx;
			// height:328upx;
			margin: 0upx auto;
			background-color: #fff;
			padding: 6upx 32upx;
			box-sizing: border-box;
			margin-top: 32upx;
			border-radius: 32upx;
			padding-bottom: 30upx;

			.line {
				display: flex;
				justify-content: space-between;
				margin-top: 36upx;

				.left {
					color: #888888;
					font-size: 32upx;
				}

				.right {
					color: #333333;
				}
			}
		}

		.logBox {
			width: 702upx;
			margin: 0 auto;
			padding-bottom: 130upx;

			.title {
				display: flex;
				justify-content: space-between;
				font-size: 32upx;
				color: #131313;
				margin: 28px 0 20upx;

				.more {
					color: #A2A2A2;
					font-size: 28upx;
				}
			}
		}
	}

	/deep/ .uni-easyinput__content {
		height: 100%;
		background-color: #F7F7F7 !important;
	}

	/deep/ .uni-popup__wrapper {
		z-index: 100000;
	}

	// 底部弹窗
	.popupTitle {
		text-align: center;
		position: relative;
		height: 110upx;
		line-height: 110upx;
		font-size: 36upx;
		border-bottom: 1upx solid #D8D8D8;

		.iconfont {
			position: absolute;
			right: 30upx;
		}
	}

	.numberBox {
		padding: 0 56upx;
		margin-top: 32upx;

		.number {
			width: 100%;
			text-align: center;
			font-size: 36upx;
			color: #3D3D3D;
			background: #F5F6F8;
			border-radius: 12upx;
			line-height: 96upx;
		}
	}

	.toAddress {
		margin-top: 0;
		border-top: 1upx solid #D8D8D8;
		border-bottom: 1upx solid #D8D8D8;
	}

	.fromAddress,
	.toAddress {
		padding: 54upx 54upx 52upx;
		font-size: 28upx;
		display: flex;

		.left {

			color: #999999;
			width: 152upx;
		}

		.right {
			flex: 1;

			.address {
				color: #3D3D3D;
				word-break: break-all;
			}

			.chain {
				color: #999999;
				font-size: 20upx;
			}
		}
	}

	.popupBtn {
		// background: red;
		padding: 30upx 40upx;
		display: flex;
		justify-content: space-between;

		.pbtn {
			font-size: 26upx;
			color: #F6F6F6;
			line-height: 88upx;
			background: linear-gradient(180deg, #A9E993 0%, #368321 100%);
			border-radius: 10upx;
			text-align: center;
			width: 46%;
		}

		.quxiaopth {
			background: #FFBC42 !important;
		}
	}
</style>